const barWidth = '20%'

const commonOption = {
  tooltip: {
    show: false
  },
  color: ['#00AEFF', '#73BF78'],
  legend: {
    show: false,
    left: 'center',
  },
  grid: {
    show: false,
    width: '100%',
    height: '100%'
  },
}
let pieOption = {
  ...commonOption,
  tooltip: {
    show: true,
    position:'right',
    backgroundColor: 'rgba(17,35,60,0.50)',
    formatter:  function (params) {
      console.log(params)
      let name=params.name
      let value=params.value
      let content=`
      <span style="color:${params.color}">${name}:${value}</span>
      `
      return content
    },
  },
  series: [
    {
      name: "china", //中国
      type: 'pie',
      itemStyle: {
        borderRadius: '50%',
      },
      center: ['50%', '50%'],
      radius: ['55%', '75%'],
      minAngle: 10,
      label: {
        show: true,
        position: 'center',
        formatter: '中国',
        backgroundColor: 'transparent',
        color: '#00AEFF'
      },
      data: []
    }
  ]
};
let barOption = {
  ...commonOption,
  tooltip: {
    show: false
  },
  grid: {
    top: '25%',
    left: 0,
    right: 40,
    bottom: '15%',
    show: false, // 默认不显示边框
    borderColor: 'white', // 边框颜色
    containLabel: true // 包含刻度文字在内
  },
  xAxis: {
    type: 'value',
    boundaryGap: [0, 0.01],
    show: false
  },
  yAxis: {
    type: 'category',
    data: [{
      value:'累计确诊',
      textStyle:{
        color:'#85ABC5'
      }
    },{
      value:'累计治愈',
      textStyle:{
        color:'#73BF78'
        // color:'#85ABC5'
      }
    }],
    axisTick: {
      show: false
    },
    axisLine: {
      show: false
    },
    showBackground:true,
    backgroundStyle:{
      color:'#00AEFF',
      opacity:0.2
    }
  },
  series: [
    {
      name: "china", //中国
      type: 'bar',
      data: [],
      barWidth: barWidth,
      barMinHeight:2,
      showBackground:true,
      backgroundStyle:{
        color:'#00AEFF',
        opacity:0.2
      },
      label:{
        show:true,
        position:'right',
        textBorderColor:'rgba(0, 0, 0, 0)',
        color:'#85ABC5',
        formatter:'{c}人'
      }
    }
  ]
};

export {
  pieOption,
  barOption,
}
